<?php

$dir = "/Users/songhao/Desktop/php/php/";

$a = scandir($dir);

$con = mysqli_connect('59.110.0.207','root','root@2017','xiaoshuo');

if(!$con){
	die('error');
}

$sql = "insert into xs_novel_chapter (chapter_cid,chapter_novel_id,chapter_name,chapter_istxt,chapter_order,chapter_create_time) values ";

$now = date('Y-m-d H:i:s');
$i = 1;
foreach($a as $v){
	if(strpos($v,'邪王嗜宠')){
		if($i == 1){
			$sql .= "(0,1,'".$v."',1,".$i.",'".$now."')";
		}else{
			$sql .= ",(0,1,'".$v."',1,".$i.",'".$now."')";
		}
		$i++;
	}
}

mysqli_query($con,$sql);

mysqli_close($con);


